package hello.word.m2.maven.jpa;

public enum ConjunctionEnum {

    And("And"," and "),
    Or("Or"," or ");


    private String conjunction;
    private String expression;

    private ConjunctionEnum(String prediate, String expression){
        this.conjunction=prediate;
        this.expression=expression;
    }

    public String getConjunction() {
        return conjunction;
    }

    public String getExpression() {
        return expression;
    }

    public static ConjunctionEnum getEnumByCode(String code){
        if(code == null){
            return null;
        }
        for(ConjunctionEnum temp:ConjunctionEnum.values()){
            if(temp.getConjunction().equals(code)){
                return temp;
            }
        }
        return null;
    }
}
